<%@ page language="java" pageEncoding="utf-8"%>

<!DOCTYPE html>
<html>
<head>
	<%@ include file="../include_new.jsp" %>
	<style type="text/css">
		.modal-lg .modal-body{height:450px !important;}
	</style>
</head>
<body id="z_body">
	<div class="panel">
		<div class="panel-heading">
			<i class="icon icon-list"></i> 
			${actName}工作台配置信息
		</div>
		<div class="panel-body">		
			<form class="form-horizontal" id="form1">	
				<div class="form-group">
					<label class="col-md-3">机器IP</label>
					<div class="col-md-6">					
						<input class="form-control" id="jqip"name="jqip" value="${one.jqip}"  readonly>
					</div>
				</div>
				<div class="form-group">
					<label class="col-md-3">配置项</label>
					<div class="col-md-6">
						<select class="form-control" onchange="getModelByIp()" name="zbxbh" id="zbxbh">
							<option value="">--请选择--</option>
							<c:forEach items="${pzx}" var="item">
							<option value="${item.id}">${item.name}</option>
							</c:forEach>
							</select>					
						<!-- <input  id="zbxbh" name="zbxbh" value=""  type="hidden" >
						<input onchange="getModelByIp()"  class="form-control app_selector" name="zbxmc"  data_tree="{type:'gztpzx'}"> -->
					</div>
				</div>
				<div class="form-group">
							<label class="col-md-3">详情</label>
							<div class="col-md-6">					
								<textarea id="zbxz" name="zbxz"class="form-control" rows="20" style="resize: none;"></textarea>
							</div>
						</div>
				<div class="form-group">
					<label class="col-md-3"></label>
					<div class="col-md-6">
						<a class="btn btn-primary" onclick="getModel()">获取模板</a> &nbsp;
						<a class="btn btn-primary" onclick="save()">保存</a> &nbsp;
						<a class="btn btn-default" onclick="parent.closeModal()">返回上一页</a>
					</div>
				</div>
				
			</form>
			
		</div>
	</div>

	
<script type="text/javascript">
	/**
	 * 获取模板
	 */
	function getModel() {
		if($("#zbxbh").val()==""){
			new $.zui.Messager("选择配置项", {
				type: 'danger'
			}).show();
		}
		zbxbh =$("#zbxbh").val();
		tool.query("getModel", {zbxbh: zbxbh}, function(res) {
			data =res.data;
			$("#zbxz").val(data.model);
		});	
	}
	function getModelByIp() {
		jqip =$("#jqip").val();
		zbxbh =$("#zbxbh").val();
		tool.query("getModelByIp", {zbxbh: zbxbh,jqip:jqip}, function(res) {
			data =res.data;
			$("#zbxz").val(data.model);
		});	
	}
	/**
	 * 保存
	 */
	function save() {
		//提交
		tool.save("saveCfg", $("#form1").serialize(), function(res) {
		});
	}
	
</script>
</body>
</html>